//
//  SpecialCollectionViewCell.m
//  Coco_Music
//
//  Created by dlios on 15-6-27.
//  Copyright (c) 2015年 寇广超. All rights reserved.
//

#import "SpecialCollectionViewCell.h"

@implementation SpecialCollectionViewCell
-(void)dealloc
{
    [_NameLabel release];
    [_myImageView release];
    [_DateLabel release];
    [_mySpecial release];
    
    [super dealloc];
}
-(instancetype)initWithFrame:(CGRect)frame
{
    self =[super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}
-(void)createSubviews
{
    self.myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height-50)];
    self.myImageView.layer.masksToBounds = YES;
    self.myImageView.layer.cornerRadius = 20;
    
    [self.contentView addSubview:self.myImageView];
    self.NameLabel =[[UILabel alloc]initWithFrame:CGRectMake(0, self.myImageView.frame.size.height, self.contentView.frame.size.width, 20)];
    self.NameLabel.font =[UIFont systemFontOfSize:15];
    self.NameLabel.textColor =[UIColor colorWithRed:0.3 green:0.4 blue:0.5 alpha:0.6];
    self.NameLabel.textAlignment  = NSTextAlignmentCenter;
    [self.contentView addSubview:self.NameLabel];
   
    self.DateLabel =[[UILabel alloc]initWithFrame:CGRectMake(0, self.NameLabel.frame.size.height+self.NameLabel.frame.origin.y, self.contentView.frame.size.width, 20)];
    self.DateLabel.font = [UIFont systemFontOfSize:13];
    self.DateLabel.textAlignment  = NSTextAlignmentCenter;
    self.DateLabel.textColor =[UIColor colorWithRed:0.7 green:0.7 blue:0.3 alpha:0.4];
    [self.contentView addSubview:self.DateLabel];
    [_DateLabel release];
    
    
}
-(void)setMySpecial:(specila *)mySpecial
{
    if (_mySpecial != mySpecial) {
        [_mySpecial release];
       _mySpecial = [mySpecial retain];
    }
    self.NameLabel.text = mySpecial.song_name;
    self.DateLabel.text = mySpecial.publishDate;
    
    NSURL *url =[NSURL URLWithString:mySpecial.picUrl];
    [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"cm2_default_artist_banner-1"]];
   
}
@end
